﻿<template>
  <div >
  <el-dialog
    :title="!dataForm.id ? $t('handle.add') : btnshow ? '修改':'详情'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <div v-loading="loading">
    <el-tabs v-model="activeName" >
    <el-tab-pane style="overflow: auto;" label="基本信息" name="first">
    <el-form :model="dataForm"  :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="150px">
    <el-form-item label="选择地址" prop="addressId">
     <el-input v-model="dataForm.addressText" placeholder="标准地址" :disabled="true" style="width:90%"></el-input><el-button style="width:10%" type="info" :disabled="isInput" plain @click="addressDialogOpen()">选择</el-button>
    </el-form-item>

    <el-row>
        <el-col :span="12">
    <el-form-item label="房屋类别" prop="type">
      <el-select v-model="dataForm.type" filterable :disabled="isInput"  placeholder="请选择" style="width:100%">
        <el-option
          v-for="item in fwlbOptions"
          :key="item.id"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </el-form-item>
        </el-col>
        <el-col :span="12">
    <el-form-item label="房屋性质" prop="nature">
      <el-select v-model="dataForm.nature" filterable :disabled="isInput"  placeholder="请选择" style="width:100%">
        <el-option
          v-for="item in fwxzOptions"
          :key="item.id"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </el-form-item>
        </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="房屋用途" prop="purpose">
          <el-select v-model="dataForm.purpose" filterable  :disabled="isInput" placeholder="请选择" style="width:100%">
            <el-option
              v-for="item in fwytOptions"
              :key="item.id"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="房屋间数" prop="number">
          <el-input v-model="dataForm.number" type="number" :disabled="isInput" placeholder="房屋间数"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="房屋面积" prop="area">
           <el-input v-model="dataForm.area" type="number" :disabled="isInput" placeholder="房屋面积（平方米）"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="房产证号" prop="propertynumber">
          <el-input v-model="dataForm.propertynumber"  :disabled="isInput" placeholder="房屋产权证号"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
        <el-col :span="12">
          <el-form-item label="房屋房主" prop="ownerIdText" >
            <el-input v-model="dataForm.ownerIdText" placeholder="选择房主" :disabled="true" style="width:78%"></el-input><el-button style="width:20%" type="info" :disabled="isInput" plain @click="peoplebuttonHandle('ownername',dataForm.ownerId)">选择</el-button>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="归属单位" prop="unitIdText">
            <el-input v-model="dataForm.unitIdText" :disabled="true" placeholder="选择归属单位" style="width:78%"></el-input><el-button style="width:20%"  type="info" :disabled="isInput" plain @click="buttonHandle('unit')">选择</el-button>
           </el-form-item>
        </el-col>
    </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item
                v-for="(domain,index) in dataForm.house_populationList.domains"
                label="入驻人员"
                :key="domain.key"
                :prop="'house_populationList.domains['+index+'].populationName'"
                :rules="{
                  required: true, message: '入驻人员不能为空', trigger: 'blur'
                }"
          >
            <!-- <el-input v-model="domain.populationName" placeholder="选择入驻人员" style="width:70%;margin-right:0px;" :disabled="true" ></el-input> -->
             <!-- <el-button style="width:20%" type="info" v-show="btnshow" :disabled="isInput" plain @click="peoplebuttonDomainsHandle(index,domain.populationId)">选择</el-button> -->
              <!-- <el-button type="success" v-show="btnshow" icon="el-icon-check" circle @click="peoplebuttonDomainsHandle(index,domain.populationId)"></el-button> -->

          <el-input v-model="domain.populationName" placeholder="选择入驻人员" :disabled="true" style="width:78%"></el-input><el-button style="width:20%" type="info" :disabled="isInput" plain @click="peoplebuttonDomainsHandle(index,domain.populationId)">选择</el-button>

            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item
            v-for="(domain,index) in dataForm.house_populationList.domains"
            label="人房入驻关系"
            :key="domain.key"
            :prop="'house_populationList.domains['+index+'].dictValue'"
            :rules="{
              required: true, message: '人房关系不能为空', trigger: 'blur'
            }">
          <el-select v-model="domain.dictValue" :disabled="isInput" placeholder="请选择" style="width:80%;">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
            <el-button style="height:30;width:30;" type="primary"   v-show="index == 0" icon="el-icon-plus" @click="addDomain" circle></el-button>
            <el-button style="margin:0px;height:30;width:30;" type="danger" v-show="index != 0" icon="el-icon-minus" @click.prevent="removeDomain(domain)" circle></el-button>
         </el-form-item>
      </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item
                v-for="(domain,index) in dataForm.house_unitList.domains"
                label="入驻单位"
                :key="domain.key"
                :prop="'house_unitList.domains['+index+'].unitName'"
                :rules="{
                  required: true, message: '单位不能为空', trigger: 'blur'
                }"
          >
            <!-- <el-input v-model="domain.unitName" placeholder="选择单位" style="width:60%;margin-right:5px;" :disabled="true" ></el-input>
              <el-button type="success" v-show="btnshow" icon="el-icon-check" circle @click="buttonHandle(index)"></el-button> -->
          <el-input v-model="domain.unitName" placeholder="选择入驻单位" :disabled="true" style="width:78%"></el-input><el-button style="width:20%" type="info" :disabled="isInput" plain @click="buttonHandle(index)">选择</el-button>
            </el-form-item>
        </el-col>
        <el-col :span="12">
            <el-form-item
            v-for="(domain,index) in dataForm.house_unitList.domains"
            label="单位房屋入驻关系"
            :key="domain.key"
            :prop="'house_unitList.domains['+index+'].dictValue'"
            :rules="{
              required: true, message: '单位和房屋关系不能为空', trigger: 'blur'
            }">
          <el-select v-model="domain.dictValue" :disabled="isInput" placeholder="请选择" style="width:80%;">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
            <el-button type="primary" style="height:30;width:30;" v-show="index == 0" icon="el-icon-plus" @click="addDomainUnit" circle></el-button>
            <el-button style="margin:0px;height:30;width:30;" type="danger" v-show="index != 0" icon="el-icon-minus" @click.prevent="removeDomainUnit(domain)" circle></el-button>
         </el-form-item>
      </el-col>
      </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="登记人姓名" prop="registrantName" v-show="false">
          <el-input v-model="dataForm.registrantNameText" placeholder="登记人姓名" :disabled="true" style="width:80%"></el-input><el-button type="info" :disabled="isInput" plain @click="peoplebuttonHandle('regname',dataForm.registrantName)">选择</el-button>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="托管人" prop="custodianId"  v-show="false">
          <el-input v-model="dataForm.custodianIdText" placeholder="托管人" :disabled="true" style="width:80%"></el-input><el-button type="info" :disabled="isInput" plain @click="peoplebuttonHandle('custname',dataForm.custodianId)">选择</el-button>
        </el-form-item>
      </el-col>
    </el-row>
    <!-- <el-row>
      <el-col :span="12">
        <el-form-item label="注销时间" prop="logoffTime">
          <el-date-picker
            v-model="dataForm.logoffTime"
            align="right"
            type="date"
            placeholder="选择注销时间"
            style="width:100%">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="更新时间" prop="updateTime">
          <el-date-picker
            v-model="dataForm.updateTime"
            align="right"
            type="date"
            placeholder="选择更新时间"
            style="width:100%">
          </el-date-picker>
        </el-form-item>
      </el-col>
    </el-row> -->
     <!-- <el-row>
      <el-col :span="12">
      <el-form-item label="标准地址" prop="addressId">
      <el-input v-model="dataForm.addressId" placeholder="标准地址"></el-input>
    </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="登记时间" prop="registrantTime">
          <el-date-picker
            v-model="dataForm.registrantTime"
            align="right"
            type="date"
            placeholder="选择登记时间"
            style="width:100%">
          </el-date-picker>
        </el-form-item>
      </el-col>
    </el-row> -->
    </el-form>
    </el-tab-pane>
    <el-tab-pane label="附属信息" name="second">
      <el-form :model="houseForm" ref="houseForm" label-width="150px">
        <el-row>
        <el-col :span="12">
          <el-form-item label="门牌号" prop="houseNumber">
            <el-input v-model="houseForm.houseNumber" placeholder="门牌号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="位置号" prop="positionNumber">
            <el-input v-model="houseForm.positionNumber" placeholder="位置号"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    </el-tab-pane>
    </el-tabs>
    <div style="text-align:right;">
      <span slot="footer" class="dialog-footer" >
      <el-button @click="visible = false">{{ $t('handle.cancel') }}</el-button>
      <el-button type="primary" v-show="btnshow" @click="dataFormSubmit()">{{ $t('handle.confirm') }}</el-button>
    </span>
    </div>
    </div>
  </el-dialog>
  <actuaunit-Dialog v-if="addOrUpdateVisible" ref="actuaunitDialog" @receiveParameters="getParameters"></actuaunit-Dialog>
  <actualpopula-Dialog v-if="pgDialogVisible" ref="actualpopulaDialog" @receiveParametersPeople="getParametersPeople"></actualpopula-Dialog>
  <address-Dialog v-if="addressVisible" ref="addressDialog" @receiveParameters="getAddressParameters"></address-Dialog>
  </div>
</template>

<script>
import { getDictFwyt, getDictFwlb, getDictFwxz } from "@/utils/dgDictionary";
import ActuaunitDialog from "../dialog/actuaunitDialog";
import ActualPopulationDialog from "../dialog/actualPopulationDialog";
import AddressDialog from "../dialog/addressDialog";
import { getDictList, getPopulationMessage, getUnitMessage } from "@/utils";
import { isContext } from "vm";
export default {
  data() {
    return {
      loading: false,
      communityId: "",
      removePopulation: [],
      activeName: "first",
      visible: false,
      isInput: false,
      houseForm: {
        id: "",
        positionNumber: "",
        houseNumber: "",
        dgStandardInfoId: "" // 房屋地址，关联标准房屋的唯一id'
      },
      dataForm: {
        id: 0,
        type: "",
        nature: "",
        purpose: "",
        number: "",
        area: "",
        propertynumber: "",
        addressId: "",
        addressText: "",
        unitId: "",
        unitIdText: "",
        ownerId: "",
        ownerIdText: "",
        custodianId: "",
        custodianIdText: "",
        registrantName: "",
        registrantNameText: "",
        registrantTime: "",
        logoffTime: "",
        updateTime: "",
        house_populationList: {
          domains: [
            {
              populationId: "",
              populationName: "",
              dictValue: ""
            }
          ]
        },
        house_unitList: {
          domains: [
            {
              unitId: "",
              unitName: "",
              dictValue: ""
            }
          ]
        }
      },
      reset_house_populationList: {
        domains: [
          {
            populationId: "",
            populationName: "",
            dictValue: ""
          }
        ]
      },
      reset_house_unitList: {
        domains: [
          {
            unitId: "",
            unitName: "",
            dictValue: ""
          }
        ]
      },
      options: [],
      dataRule: {
        type: [
          { required: true, message: "房屋类别不能为空", trigger: "blur" }
        ],
        nature: [
          { required: true, message: "房屋性质不能为空", trigger: "blur" }
        ],
        purpose: [
          { required: true, message: "房屋用途不能为空", trigger: "blur" }
        ],
        number: [
          { required: true, message: "房屋间数不能为空", trigger: "blur" }
        ],
        area: [
          {
            required: true,
            message: "房屋面积_（平方米）不能为空",
            trigger: "blur"
          }
        ],
        propertynumber: [
          { required: true, message: "房屋产权证号不能为空", trigger: "blur" }
        ],
        addressId: [
          { required: true, message: "标准地址不能为空", trigger: "blur" }
        ]
        // unitIdText: [
        //   { required: true, message: '实有单位不能为空', trigger: 'blur' }
        // ],
        // ownerIdText: [
        //   { required: true, message: '房主不能为空', trigger: 'blur' }
        // ]
        // custodianId: [
        //   { required: true, message: '托管人不能为空', trigger: 'blur' }
        // ],
        // registrantName: [
        //   { required: true, message: '登记人姓名不能为空', trigger: 'blur' }
        // ],
        // registrantTime: [
        //   { required: true, message: '登记时间不能为空', trigger: 'blur' }
        // ],
        // logoffTime: [
        //   { required: true, message: '注销时间不能为空', trigger: 'blur' }
        // ],
        // updateTime: [
        //   { required: true, message: '更新时间不能为空', trigger: 'blur' }
        // ]
      },
      fwytOptions: [],
      fwlbOptions: [],
      fwxzOptions: [],
      addOrUpdateVisible: false,
      pgDialogVisible: false,
      addressVisible: false,
      btnshow: true
    };
  },
  components: {
    "actuaunit-Dialog": ActuaunitDialog,
    "actualpopula-Dialog": ActualPopulationDialog,
    "address-Dialog": AddressDialog
  },
  computed: {
    // addressId() {
    //   return this.$store.state.address.id;
    // }
    regionId() {
      return this.$store.state.address.regionId;
    }
  },
  methods: {
    // 添加人员房屋选择输入框
    addDomain() {
      this.dataForm.house_populationList.domains.push({
        populationId: "",
        populationName: "",
        dictValue: ""
      });
    },
    // 移除一个人员房屋选择输入框
    removeDomain(item) {
      // 记录被移除的人与小区id，在点击确定后把权限处理掉
      this.removePopulation.push(item.populationId);
      var index = this.dataForm.house_populationList.domains.indexOf(item);
      if (index !== 0) {
        this.dataForm.house_populationList.domains.splice(index, 1);
      }
    },
    // 添加单位房屋选择输入框
    addDomainUnit() {
      this.dataForm.house_unitList.domains.push({
        unitId: "",
        unitName: "",
        dictValue: ""
      });
    },
    // 移除一个单位房屋选择输入框
    removeDomainUnit(item) {
      var index = this.dataForm.house_unitList.domains.indexOf(item);
      if (index !== 0) {
        this.dataForm.house_unitList.domains.splice(index, 1);
      }
    },
    /**初始化房屋附表基本信息 */
    initHouse(id) {
      this.$nextTick(() => {
        this.$refs["houseForm"].resetFields();
        this.$http({
          url: `/dg-ic/ic/room/info/${id}`,
          method: "get",
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.houseForm.positionNumber = data.data.positionNumber;
            this.houseForm.houseNumber = data.data.houseNumber;
            this.houseForm.dgStandardInfoId = data.data.dgStandardInfoId;
          }
        });
      });
    },
    init(id, detail, communityId) {
      this.removePopulation = [];
      this.communityId = communityId;
      this.dataForm.house_populationList = JSON.parse(
        JSON.stringify(this.reset_house_populationList)
      );
      this.dataForm.house_unitList = JSON.parse(
        JSON.stringify(this.reset_house_unitList)
      );
      this.dataForm.ownerIdText = "";
      this.dataForm.ownerId = "";
      this.isInput = false;
      this.dataForm.custodianIdText = "";
      this.dataForm.addressText = "";
      this.dataForm.unitIdText = "";
      this.dataForm.registrantNameText = "";
      this.btnshow = true;
      this.getSelectData();
      this.dataForm.id = id || 0;
      this.visible = true;
      if (detail) {
        this.btnshow = false;
        this.isInput = true;
      }
      this.$nextTick(() => {
        this.$refs["dataForm"].resetFields();
        if (this.dataForm.id) {
          this.$http({
            // url: this.$http.adornUrl(`/dgactualhouse/info/${this.dataForm.id}`),
            url: `/dg-standard-info/dgactualhouse/inforegister/${
              this.dataForm.id
            }`,
            method: "get",
            params: this.$http.adornParams()
          }).then(({ data }) => {
            if (data && data.code === 0) {
              this.dataForm.type = data.dgActualHouse.type;
              this.dataForm.nature = data.dgActualHouse.nature;
              this.dataForm.purpose = data.dgActualHouse.purpose;
              this.dataForm.number = data.dgActualHouse.number;
              this.dataForm.area = data.dgActualHouse.area;
              this.dataForm.propertynumber = data.dgActualHouse.propertynumber;
              this.dataForm.addressId = data.dgActualHouse.addressId;
              this.dataForm.addressText =
                data.dgActualHouse.houseAdreess.addressName;
              if (data.dgActualHouse.dgActualUnitEntity !== null) {
                this.dataForm.unitId =
                  data.dgActualHouse.dgActualUnitEntity.unitCode;
                this.dataForm.unitIdText =
                  data.dgActualHouse.dgActualUnitEntity.name;
              }
              if (data.dgActualHouse.ownerEntity !== null) {
                this.dataForm.ownerId =
                  data.dgActualHouse.ownerEntity.populationCoding;
                this.dataForm.ownerIdText = data.dgActualHouse.ownerEntity.name;
              }

              // getPopulationMessage(data.dgActualHouse.ownerId).then(({data}) => {
              //   if(data.dgActualPopulation){
              //     this.dataForm.ownerIdText = data.dgActualPopulation.name
              //   }
              // })
              // getUnitMessage(data.dgActualHouse.unitId).then(({data}) => {
              //   if(data.dgActualUnit){
              //     this.dataForm.unitIdText = data.dgActualUnit.name
              //   }
              // })
              // this.dataForm.custodianId = data.dgActualHouse.custodianId
              // getPopulationMessage(data.dgActualHouse.custodianId).then(({data}) => {
              //   if(data.dgActualPopulation){
              //     this.dataForm.custodianIdText = data.dgActualPopulation.name
              //   }
              // })
              // this.dataForm.registrantName = data.dgActualHouse.registrantName
              // getPopulationMessage(data.dgActualHouse.registrantName).then(({data}) => {
              //   if(data.dgActualPopulation){
              //     this.dataForm.registrantNameText = data.dgActualPopulation.name
              //   }
              // })
              this.dataForm.registrantTime = data.dgActualHouse.registrantTime;
              this.dataForm.logoffTime = data.dgActualHouse.logoffTime;
              this.dataForm.updateTime = data.dgActualHouse.updateTime;
              this.dataForm.house_populationList.domains =
                data.dgActualHouse.housePopulationVo;
              this.dataForm.house_unitList.domains =
                data.dgActualHouse.houseUnitVo;
            }
          });
        }
      });
    },
    buttonHandle(index) {
      console.log(index);
      this.addOrUpdateVisible = true;
      this.$nextTick(() => {
        this.$refs.actuaunitDialog.init(index);
      });
    },
    addressDialogOpen() {
      this.addressVisible = true;
      this.$nextTick(() => {
        this.$refs.addressDialog.init();
      });
    },
    peoplebuttonDomainsHandle(index, code) {
      let _this = this;
      code = "";
      let idcard = "";
      if (code === "") {
        _this.pgDialogVisible = true;
        _this.$nextTick(() => {
          _this.$refs.actualpopulaDialog.init(index, idcard);
        });
      } else {
        this.$http({
          // url: this.$http.adornUrl(`/dgactualpopulation/info/` + code),
          url: `/dg-standard-info/dgactualpopulation/info/` + code,
          method: "get",
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            idcard = data.dgActualPopulation.identityNumber;
            _this.pgDialogVisible = true;
            _this.$nextTick(() => {
              _this.$refs.actualpopulaDialog.init(index, idcard);
            });
          }
        });
      }
    },
    peoplebuttonHandle(type, code) {
      let _this = this;
      let idcard = "";
      if (code === "") {
        _this.pgDialogVisible = true;
        _this.$nextTick(() => {
          _this.$refs.actualpopulaDialog.init(type, idcard);
        });
      } else {
        this.$http({
          // url: this.$http.adornUrl(`/dgactualpopulation/info/` + code),
          url: `/dg-standard-info/dgactualpopulation/info/` + code,
          method: "get",
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            idcard = data.dgActualPopulation.identityNumber;
            _this.pgDialogVisible = true;
            _this.$nextTick(() => {
              _this.$refs.actualpopulaDialog.init(type, idcard);
            });
          }
        });
      }
    },
    // 实有单位弹框返回数据接收
    getParameters(data, index) {
      if (index === "unit") {
        this.dataForm.unitId = data.selectId;
        this.dataForm.unitIdText = data.selectText;
      } else {
        this.dataForm.house_unitList.domains[index].unitId = data.selectId;
        this.dataForm.house_unitList.domains[index].unitName = data.selectText;
      }
    },
    getAddressParameters(data) {
      this.dataForm.addressId = data.selectId;
      this.dataForm.addressText = data.selectText;
    },
    // 人员姓名弹框返回数据接收
    getParametersPeople(data, index) {
      if (index === "ownername") {
        this.dataForm.ownerId = data.selectId;
        this.dataForm.ownerIdText = data.selectText;
      } else {
        this.dataForm.house_populationList.domains[index].populationId =
          data.selectId;
        this.dataForm.house_populationList.domains[index].populationName =
          data.selectText;
      }
      // if (type === 'ownername') {
      //   this.dataForm.ownerId = data.selectId
      //   this.dataForm.ownerIdText = data.selectText
      // } else if (type === 'regname') {
      //    this.dataForm.registrantName = data.selectId
      //    this.dataForm.registrantNameText = data.selectText
      // } else if (type === 'custname') {
      //    this.dataForm.custodianId = data.selectId
      //    this.dataForm.custodianIdText = data.selectText
      // }
    },
    // 表单提交
    dataFormSubmit() {
      this.$refs["dataForm"].validate(valid => {
        if (valid) {
          this.loading = true;
          this.$http({
            // url: this.$http.adornUrl(`/dgactualhouse/${!this.dataForm.id ? 'save' : 'update'}`),
            //  url: this.urlSuf+ `/dgactualhouse/${!this.dataForm.id ? 'save' : 'update'}`,
            // url: `/dg-standard-info/dgactualhouse/registersaveorupdate`,
            url: `/dg-ic/ic/room/insertorupdate`,
            method: "post",
            data: this.$http.adornData({
              id: this.dataForm.id || undefined,
              type: this.dataForm.type,
              nature: this.dataForm.nature,
              purpose: this.dataForm.purpose,
              number: this.dataForm.number,
              area: this.dataForm.area,
              propertynumber: this.dataForm.propertynumber,
              addressId: this.dataForm.addressId,
              unitId: this.dataForm.unitId,
              ownerId: this.dataForm.ownerId,
              // 'custodianId': this.dataFownerIdorm.custodianId,
              // 'registrantName': this.dataForm.registrantName,
              registrantTime: this.dataForm.registrantTime,
              logoffTime: this.dataForm.logoffTime,
              updateTime: this.dataForm.updateTime,
              sysCreateBy: this.$store.state.user.id,
              sysUpdateBy: this.$store.state.user.id,
              housePopulationVo: this.dataForm.house_populationList.domains,
              houseUnitVo: this.dataForm.house_unitList.domains,
              // 附表信息
              houseNumber: this.houseForm.houseNumber,
              positionNumber: this.houseForm.positionNumber
            })
          }).then(({ data }) => {
            if (data && data.code === 0) {
              // 将记录的移除人员id和小区id发送给后台删除设备权限
              this.$http({
                url: `/dg-ic/ic/device/permission/delete`, // 发送后台删除与该人员id有关的小区id设备权限
                method: "DELETE",
                data: this.$http.adornData({
                  personnelIds: this.removePopulation,
                  housingEstateId:
                    sessionStorage.getItem("thiscommunityId") === "null"
                      ? this.communityId
                      : sessionStorage.getItem("thiscommunityId")
                })
              }).then(({ data }) => {
                if (data && data.code === 0 && data.msg !== "") {
                  this.$message({
                    message: "操作成功",
                    type: "success",
                    duration: 1000,
                    onClose: () => {
                      this.loading = false;
                      this.visible = false;
                      this.$emit("refreshDataList");
                    }
                  });
                } else {
                  this.$message({
                    message: "操作成功,但移除人员设备权限时出错",
                    type: "error",
                    duration: 1000,
                    onClose: () => {
                      this.loading = false;
                      this.visible = false;
                      this.$emit("refreshDataList");
                    }
                  });
                }
              });
            } else {
              this.$message.error(data.msg);
              this.loading = false;
            }
          });
        }
      });
    },
    getSelectData() {
      getDictList("house_usage").then(({ data }) => {
        this.fwytOptions = data.dictList;
      });
      getDictList("house_type").then(({ data }) => {
        this.fwlbOptions = data.dictList;
      });
      getDictList("house_property").then(({ data }) => {
        this.fwxzOptions = data.dictList;
      });
      getDictList("type").then(({ data }) => {
        if (data && data.code === 0) {
          this.options = data.dictList;
        }
      });
      // this.getAddress()
    },

    getAddress() {
      this.$http({
        // url: this.$http.adornUrl(`/dgactualhouse/${!this.dataForm.id ? 'save' : 'update'}`),
        url: `/dg-standard-info/dgstandardaddress/list`,
        method: "post",
        data: this.$http.adornData({
          regionId: this.addressId
        })
      }).then(({ data }) => {
        if (data && data.code === 0) {
          console.log(data.page.list);
        } else {
        }
      });
    }
  }
};
</script>

<style>
/* .el-input.is-disabled .el-input__inner {
    color: #606266;
}
.custom-3E8EF7 .el-form-item.is-required .el-form-item__label:before {
    font-size: 22px;
}
.custom-3E8EF7 .el-input.is-disabled .el-input__inner {
  color: #00000088;
} */
.custom-002140 .el-button.is-circle {
    padding: 10px;
}
</style>
